/* ========================================== */
/* REFONTE DESIGN MODERNE & PROFESSIONNELLE */
/* Appliqué en priorité haute pour override */
/* ========================================== */

/* --- VARIABLES AMÉLIORÉES POUR LIGHT MODE --- */
body.light-mode {
    --text-primary: #1a1a2e;
    --text-secondary: #333333;
    --text-tertiary: #666666;
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --input-text: #1a1a2e;
    --label-color: #0A1172;
}

/* --- REFONTE BOUTONS SECONDAIRES --- */
.btn-read-more, .btn-directions, .btn-download {
    padding: 12px 28px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 2px solid var(--gold);
    background-color: transparent;
    color: var(--gold);
    cursor: pointer;
    display: inline-block;
}

.btn-read-more:hover, .btn-directions:hover, .btn-download:hover {
    background-color: var(--gold);
    color: var(--primary-blue);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.3);
}

body.light-mode .btn-read-more, 
body.light-mode .btn-directions, 
body.light-mode .btn-download {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

body.light-mode .btn-read-more:hover, 
body.light-mode .btn-directions:hover, 
body.light-mode .btn-download:hover {
    background-color: var(--primary-blue);
    color: white;
}

/* --- CARDS AMÉLIORÉES --- */
.card {
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
    transition: all 0.3s ease !important;
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
}

.card:hover {
    transform: translateY(-8px) !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25) !important;
}

body.light-mode .card {
    box-shadow: 0 8px 24px rgba(10, 17, 114, 0.08) !important;
}

body.light-mode .card:hover {
    box-shadow: 0 12px 32px rgba(10, 17, 114, 0.15) !important;
}

.card-header {
    background: linear-gradient(135deg, var(--ultramarine), var(--glow)) !important;
    border-bottom: none !important;
    padding: 20px !important;
    font-weight: 700 !important;
}

body.light-mode .card-header {
    background: linear-gradient(135deg, #0A1172, #4169e1) !important;
    color: white !important;
}

.card-body {
    padding: 24px !important;
    color: var(--text-primary) !important;
}

body.light-mode .card-body {
    color: #333333 !important;
}

.card-body ul li {
    margin-bottom: 8px;
    line-height: 1.6;
}

/* --- SECTIONS & SPACING AMÉLIORÉS --- */
section {
    padding: var(--section-gap) 10% !important;
}

.section-title {
    font-size: clamp(1.75rem, 4vw, 2.8rem) !important;
    margin-bottom: 60px !important;
    color: var(--text-primary) !important;
    font-weight: 700 !important;
}

.section-title::after {
    height: 5px !important;
    width: 70px !important;
    background: linear-gradient(90deg, var(--gold), #f0d700) !important;
    border-radius: 3px !important;
}

/* --- INPUTS & FORMULAIRES AMÉLIORÉS --- */
.form-group label {
    color: var(--label-color) !important;
    font-weight: 600 !important;
    margin-bottom: 10px !important;
    font-size: 0.95rem !important;
}

.form-group input,
.form-group textarea,
.submission-form-input,
.submission-form-select {
    border-radius: 8px !important;
    border: 2px solid var(--border-color) !important;
    background: var(--input-bg) !important;
    color: var(--input-text) !important;
    padding: 13px 16px !important;
    transition: all 0.3s ease !important;
    font-size: 1rem !important;
}

.form-group input:focus,
.form-group textarea:focus,
.submission-form-input:focus,
.submission-form-select:focus {
    border-color: var(--gold) !important;
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.1) !important;
    outline: none !important;
}

body.light-mode .form-group input,
body.light-mode .form-group textarea,
body.light-mode .submission-form-input,
body.light-mode .submission-form-select {
    background: #ffffff !important;
    border-color: #e0e0e0 !important;
    color: #1a1a2e !important;
}

/* --- HERO SECTION AMÉLIORÉ --- */
.hero {
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.hero h2 {
    font-size: clamp(2.2rem, 6vw, 4rem) !important;
    line-height: 1.2 !important;
    margin-bottom: 20px !important;
}

.hero p {
    font-size: clamp(1.2rem, 2vw, 1.8rem) !important;
    line-height: 1.6 !important;
    margin-bottom: 30px !important;
}

/* --- FOOTER AMÉLIORÉ --- */
footer {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-top: 2px solid var(--border-color) !important;
    padding: 80px 10% 30px !important;
}

body.light-mode footer {
    background: #ffffff !important;
}

footer h3 {
    color: var(--gold) !important;
    font-size: 1.2rem !important;
    margin-bottom: 20px !important;
}

.footer-section p {
    line-height: 1.8;
    color: var(--text-secondary) !important;
}

/* --- GALLERY AMÉLIORÉE --- */
.gallery-item {
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.3s ease !important;
    aspect-ratio: 1 / 1;
}

.gallery-item:hover {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2) !important;
}

.gallery-item img {
    transition: transform 0.4s ease !important;
}

.gallery-item:hover img {
    transform: scale(1.08) !important;
}

/* --- THEME BUTTON AMÉLIORÉ --- */
.theme-btn {
    bottom: 140px !important;
    right: 20px !important;
    width: 50px !important;
    height: 50px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, var(--primary-blue), var(--ultramarine)) !important;
    border: 3px solid var(--gold) !important;
    color: var(--gold) !important;
    font-size: 1.3rem !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.2) !important;
    z-index: 1999 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.theme-btn:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 8px 28px rgba(255, 215, 0, 0.4) !important;
}

/* --- NEWS GRID (INSTAGRAM-LIKE) AMÉLIORÉ --- */
.news-grid .card {
    border-radius: 12px !important;
    overflow: hidden !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.news-grid .card:hover {
    transform: translateY(-8px) !important;
}

.news-grid .card .card-header {
    padding: 14px 12px !important;
    background: linear-gradient(135deg, rgba(65,105,225,0.08), rgba(255,215,0,0.04)) !important;
    border-bottom: 1px solid rgba(255,215,0,0.1) !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.news-grid .card .card-header .avatar {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
    box-shadow: 0 2px 8px rgba(65,105,225,0.2) !important;
}

.news-grid .card .card-header .avatar img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.news-grid .card .card-header .meta {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
}

.news-grid .card .card-header .meta .name {
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    color: var(--white) !important;
}

.news-grid .card .card-header .meta .news-date {
    font-size: 0.8rem !important;
    color: var(--gold) !important;
    font-weight: 500 !important;
    margin: 0 !important;
}

.news-grid .card .card-header .meta .text-muted {
    font-size: 0.75rem !important;
    color: rgba(255,255,255,0.6) !important;
}

.news-grid .card .card-body {
    padding: 14px 12px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
}

.news-grid .card .actions {
    display: flex !important;
    gap: 12px !important;
    align-items: center !important;
    flex-wrap: wrap !important;
}

.news-grid .card .actions .action-btn {
    transition: all 0.2s ease !important;
    padding: 8px 12px !important;
    font-size: 1.1rem !important;
    background: transparent !important;
    border: none !important;
    color: var(--white) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.news-grid .card .actions .action-btn:hover {
    transform: scale(1.1) !important;
    color: var(--gold) !important;
}

.news-grid .card .actions .action-btn.liked {
    color: #e0245e !important;
}

.news-grid .card .actions .action-btn.liked i {
    animation: fa-beat 0.4s infinite !important;
}

.news-grid .card .likes {
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    color: var(--white) !important;
    margin-left: auto !important;
}

.news-grid .card .comments-count {
    font-size: 0.85rem !important;
    color: rgba(255,255,255,0.7) !important;
}

.news-grid .card .caption {
    color: var(--white) !important;
    font-size: 0.95rem !important;
    line-height: 1.4 !important;
    font-weight: 500 !important;
}

/* --- POLL (FACEBOOK-LIKE) AMÉLIORÉ --- */
.poll-facebook {
    border-radius: 12px !important;
    padding: 16px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
}

.poll-facebook .poll-option button.option-btn {
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
    font-weight: 500 !important;
}

.poll-facebook .poll-option button.option-btn:hover {
    border-color: var(--gold) !important;
}

/* --- TIMELINE AMÉLIORÉ --- */
.timeline-content {
    border-radius: 10px !important;
    padding: 24px !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.3s ease !important;
}

.timeline-content:hover {
    transform: scale(1.02) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important;
}

.timeline-date {
    font-weight: 700 !important;
    color: var(--gold) !important;
    margin-bottom: 8px !important;
}

/* --- RESPONSIVE AMÉLIORÉ --- */
@media (max-width: 768px) {
    .section-title {
        font-size: 1.6rem !important;
        margin-bottom: 40px !important;
    }
    
    section {
        padding: 60px 5% !important;
    }
    
    .card {
        padding: 15px !important;
    }
    
    .hero h2 {
        font-size: 2rem !important;
    }
    
    .hero p {
        font-size: 1.1rem !important;
    }
    
    .btn-cta, .btn-submit, .btn-read-more, .btn-directions, .btn-download {
        padding: 12px 24px !important;
        font-size: 0.9rem !important;
    }
}

@media (max-width: 480px) {
    section {
        padding: 40px 3% !important;
    }
    
    .section-title {
        font-size: 1.4rem !important;
        margin-bottom: 30px !important;
    }
    
    .card {
        padding: 12px !important;
    }
    
    footer {
        padding: 40px 5% 20px !important;
    }
}

/* --- ANIMATIONS FLUIDES --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card, .section-title {
    animation: fadeInUp 0.6s ease-out;
}

/* --- HIGHLIGHT CONTRASTE (LIGHT MODE) --- */
body.light-mode .highlight {
    background-color: rgba(10, 17, 114, 0.15) !important;
    color: var(--primary-blue) !important;
}

/* --- LED SUR CARTES & TIMELINE --- */
.card { position: relative; }
.card::after {
    content: '';
    position: absolute;
    top: 12px;
    left: 12px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #ffffff, var(--gold));
    box-shadow: 0 0 18px 6px rgba(255,215,0,0.12), 0 0 6px 2px rgba(255,215,0,0.08);
    border: 2px solid rgba(255,255,255,0.12);
    pointer-events: none;
}

body.light-mode .card::after {
    border-color: rgba(10,17,114,0.15);
}

.timeline-content { position: relative; }
.timeline-content::before {
    content: '';
    position: absolute;
    left: -18px;
    top: 18px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(90deg, var(--gold), #ffec8b);
    box-shadow: 0 0 12px rgba(255,215,0,0.12);
}

/* small LED for smaller cards (override) */
.card.small-led::after { width:10px; height:10px; top:10px; left:10px; }

/* Shared layout constraints for narrow screens and long user content. */
body {
    overflow-wrap: anywhere;
}

img, video, iframe, canvas {
    max-width: 100%;
}

input, select, textarea {
    min-width: 0;
    max-width: 100%;
}

.menu-toggle {
    display: none;
}

body > header + section:not(.hero) {
    padding-top: 160px !important;
}

.dashboard-main-grid {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
}

.dashboard-main-grid > .dash-section {
    min-width: 0;
    padding: 24px !important;
}

.dashboard-welcome {
    gap: 20px;
    flex-wrap: wrap;
}

.dashboard-stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

.admin-form-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

.admin-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
}

.dashboard-welcome > *, .dash-stat-card > *, .admin-form-grid > *,
.submission-grid > *, .card-body, .poll-option > *, .chat-input input {
    min-width: 0;
}

.modal-content {
    width: min(600px, calc(100% - 32px));
    max-height: calc(100dvh - 32px);
    margin: 16px auto;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.sms-toast {
    max-width: calc(100% - 40px);
}

.news-grid .card .card-header {
    flex-wrap: wrap;
    align-items: flex-start;
}

.news-grid .card .card-header > span,
.news-grid .card .card-header > .news-author {
    flex-basis: 100%;
}

@media (max-width: 1000px) {
    .dashboard-main-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 900px) {
    body > header, body > header.scrolled {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 8px;
        padding: 10px 16px;
        background: var(--bg-secondary);
    }

    body > header .logo {
        min-width: 0;
        gap: 2px;
    }

    body > header .logo img {
        width: 52px;
        height: 52px;
    }

    body > header .logo span {
        font-size: 0.75rem;
    }

    body > header nav {
        flex-basis: 100%;
    }

    body > header nav ul {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }

    body > header.has-mobile-menu .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        flex: 0 0 44px;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        color: var(--text-primary);
        background: var(--bg-tertiary);
        font-size: 1.3rem;
        cursor: pointer;
    }

    body > header.has-mobile-menu nav {
        display: none;
    }

    body > header.menu-open nav {
        display: block;
        max-height: calc(100dvh - 110px);
        overflow-y: auto;
    }

    body > header.menu-open nav ul {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
    }

    body > header nav a {
        display: flex;
        align-items: center;
        min-height: 44px;
        gap: 10px;
        padding: 8px;
        font-size: 0.75rem;
        text-transform: none;
    }

    body > header nav a::after {
        content: attr(aria-label);
    }

    body > header nav a i {
        flex: 0 0 24px;
        text-align: center;
    }

    body.light-mode > header nav a,
    body.light-mode > header:not(.scrolled) .logo span {
        color: var(--primary-blue);
        text-shadow: none;
    }

    body > header + section:not(.hero) {
        padding-top: 120px !important;
    }

    .dashboard-container {
        margin-top: 120px;
        padding: 0 16px;
    }

    .hero {
        height: auto;
        min-height: 80svh;
        padding-top: 130px !important;
    }

    #accueil .hero-scroll-content {
        width: 100%;
        align-items: center;
        animation: none;
    }

    .hero-student-img {
        display: none;
    }
}

@media (max-width: 768px) {
    .about-content {
        padding: 20px;
        gap: 24px;
    }

    .about-text, .about-img, .proviseur-text, .footer-section {
        min-width: 0;
        flex-basis: 100%;
    }

    .proviseur-img {
        width: min(100%, 350px);
    }

    .proviseur-img img {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
    }

    .mission-list, .features-grid, .cards-container, .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
    }

    .submission-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .news-grid .card {
        min-width: 0;
        width: min(300px, 100%);
        flex-basis: min(300px, 100%);
    }

    .testimonial-card {
        min-width: 0;
        width: min(350px, 85vw);
        flex-basis: min(350px, 85vw);
        padding: 24px;
    }

    .timeline::after {
        left: 10px;
    }

    .timeline-item:nth-child(n) {
        width: 100%;
        left: 0;
        padding: 10px 0 10px 36px;
        text-align: left;
    }

    .timeline-item:nth-child(n)::after {
        left: 0;
        right: auto;
    }

    .contact-form form {
        padding: 24px 16px;
    }

    .dashboard-welcome {
        padding: 20px;
    }

    .dashboard-welcome h2 {
        font-size: 1.75rem;
    }

    .dash-stat-card {
        padding: 16px;
        gap: 12px;
    }

    .stat-icon-box {
        flex-shrink: 0;
    }

    .admin-form input, .admin-form select, .admin-form textarea,
    .chat-input input, #news-search, #team-search, #admin-user-search {
        font-size: 1rem;
    }

    .admin-user-search, .admin-import-actions {
        flex-wrap: wrap;
    }

    .admin-user-search > *, .admin-import-actions > * {
        flex-basis: 100% !important;
    }

    .btn-submit, .btn-cta, .btn-read-more, .btn-download, .btn-directions {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .modal-content {
        padding: 20px;
    }

    .ai-chat-box {
        right: 12px;
        bottom: 80px;
        width: min(360px, calc(100% - 24px));
        height: min(450px, calc(100dvh - 104px));
    }

    .chat-input button {
        flex-shrink: 0;
    }

    .poll-facebook .poll-option {
        flex-wrap: wrap;
    }

    .poll-facebook .poll-option button.option-btn {
        flex-basis: 100%;
    }

    .poll-facebook .poll-option .progress-wrap {
        width: 100%;
    }
}
